﻿using System;

namespace CollegeSim.CourseScheduler.Domain.Entities
{
    // Author: Ryan Redburn
    // Project: Course Scheduler
    // Date: 2/4/2014

    public class Student : Person
    {
        #region [ Fields ]

        private int _yearsAttended;
        private decimal _gpa;

        #endregion

        #region [ Properties ]

        // Student YearsAttended
        public int YearsAttended
        {
            get { return _yearsAttended; }
            set
            {
                if (value >= 0 && value <= 4)
                {
                    _yearsAttended = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("value", "YearsAttended cannot be less than zero or greater then four.");
                }
            }
        }

        // Student GPA
        // Format: 3.755
        public decimal GPA
        {
            get { return _gpa; }
            set
            {
                if (value >= 0 && value <= 4)
                {
                    _gpa = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("value", "GPA cannot be less than zero or greater then four.");
                }
            }
        }

        #endregion

        #region [ Constructors ]

        public Student()
        {
            Id = 0;
        }

        #endregion

        #region [ Methods ]

        // Returns name and phonenumber
        // Format: LastName, FirstName - PhoneNumber
        public override string ToString()
        {
            return LastName + ", " + FirstName + " - " + PhoneNumber;
        }

        #endregion
    }
}
